#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<assert.h>

typedef int HPDataType;
typedef struct Heap
{
	HPDataType* a;
	int size;
	int capacity;
}Heap;

void HeapInit(Heap* hp);
void Heapdestroy(Heap* hp);
void HeapPush(Heap* hp,HPDataType x);
void HeapPop(Heap* hp);
HPDataType HeapTop(Heap* hp);
bool HeapEmpty(Heap* hp);
int HeapSize(Heap* hp);
void HeapSort(int* a,int n);

void AdjustDown(HPDataType* a, int n, int parent);
